package com.ee.chat.admin.controller.auditmanage;

import com.ee.chat.admin.service.IWithdrawService;
import com.ee.chat.common.bean.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("audit/withdraw")
public class WithdrawController {
    private Logger log = LoggerFactory.getLogger(WithdrawController.class);

    @Resource
    IWithdrawService withdrawService;

    /**
     * 提现列表
     * @Author Shane
     * @Date 2019/10/2319:12
     * @param
     * @return
     **/
    @RequestMapping("list")
    public Result list(HttpServletRequest request, Integer userId, Integer status, Integer type, String createTime,
                       String field, String sort, @RequestParam Integer page, @RequestParam Integer limit){
        try {
            return withdrawService.list(request, userId, status, type, createTime, field, sort, page, limit);
        } catch (Exception e){
            log.error("【获取提现列表错误】", e);
        }
        return Result.returnFailure();
    }

    /**
     * 提现审核
     * @Author Shane
     * @Date 2019/10/2319:45
     * @param id        提现记录d
     * @param status    状态，1-通过  2-拒绝
     * @param reason    理由
     * @return
     **/
    @RequestMapping("audit")
    public Result audit(HttpServletRequest request, @RequestParam Integer id, @RequestParam Integer status, String reason){
        try {
            return withdrawService.audit(request, id, status, reason);
        } catch (Exception e){
            log.error("【提现审核错误】", e);
        }
        return Result.returnFailure();
    }
}
